package com.yang.web.config;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class MyContextListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //将web应用名称保存到application
        ServletContext application=sce.getServletContext();
        String path=application.getContextPath();
        application.setAttribute("App_path","laisla");
        System.out.println("chuangjian");

    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("销毁");
    }
}
